package com.tianshi.yingxue_project.service.impl;

import com.tianshi.yingxue_project.dao.AdminDao;
import com.tianshi.yingxue_project.entity.Admin;
import com.tianshi.yingxue_project.service.AdminService;
import com.tianshi.yingxue_project.utils.Md5Utils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
//import org.springframework.transaction.annotation.Transactional;


@Service
//@Transactional
public class AdminServiceImpl implements AdminService {
    @Autowired
    private AdminDao adminDao;

    @Override
    public void  register(Admin admin){
        String salt= Md5Utils.getSalt(6);
        admin.setSalt(salt);
        String passwword=salt+admin.getPassword();

        String md5Code=Md5Utils.getMd5Code(passwword);
        admin.setPassword(md5Code);
        adminDao.insertAdmin(admin);
    }
}
